import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../views/HomeView.vue'

Vue.use(VueRouter)

const originalPush = VueRouter.prototype.push
// 解决ElementUI导航栏中的vue-router在3.0版本以上重复点菜单报错问题
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}


const routes = [
  {
    path: '/',
    name: 'home',
    component: HomeView
  },
  {
    path: '/about',
    name: 'about',
    component: () => import(/* webpackChunkName: "about" */ '../views/AboutView.vue')
  },
  {
    path: '/detail',
    name: 'detail',
    component: () => import('../views/detailView.vue')
  },
  {
    path: '/registerNow',
    name: 'registerNow',
    component: () => import('../views/RegisterNow.vue')
  },
  {
    path: '/personalCenter',
    name: 'personalCenter',
    component: () => import('../views/personalCenter.vue')
  },
  {
    path: '/endDetail',
    name: 'endDetail',
    component: () => import('../views/endDetails.vue')
  }
]

const router = new VueRouter({
  routes
})

export default router
